unit uRepresentante;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uPai, DBCtrls, Grids, DBGrids, StdCtrls, Mask, DB, Buttons,
  ExtCtrls, ComCtrls;

type
  TfRepresentante = class(TfPai)
    DBEdit1: TDBEdit;
    Label1: TLabel;
    DBEdit2: TDBEdit;
    Label2: TLabel;
    Label3: TLabel;
    DBEdit3: TDBEdit;
    DBComboBox2: TDBComboBox;
    DBComboBox4: TDBComboBox;
    Label21: TLabel;
    Label18: TLabel;
    DBEdit4: TDBEdit;
    Label4: TLabel;
    Label5: TLabel;
    DBEdit5: TDBEdit;
    DBEdit6: TDBEdit;
    Label6: TLabel;
    DBEdit7: TDBEdit;
    Label7: TLabel;
    DBEdit8: TDBEdit;
    Label8: TLabel;
    DBNavigator1: TDBNavigator;
    DBGrid1: TDBGrid;
    procedure FormShow(Sender: TObject);
    procedure DBEdit1Enter(Sender: TObject);
    procedure DBEdit1Exit(Sender: TObject);
    procedure DBEdit2Enter(Sender: TObject);
    procedure DBEdit2Exit(Sender: TObject);
    procedure DBEdit3Enter(Sender: TObject);
    procedure DBEdit3Exit(Sender: TObject);
    procedure DBComboBox2Exit(Sender: TObject);
    procedure DBComboBox2Enter(Sender: TObject);
    procedure DBComboBox4Exit(Sender: TObject);
    procedure DBComboBox4Enter(Sender: TObject);
    procedure DBEdit4Enter(Sender: TObject);
    procedure DBEdit4Exit(Sender: TObject);
    procedure DBEdit5Exit(Sender: TObject);
    procedure DBEdit5Enter(Sender: TObject);
    procedure DBEdit6Enter(Sender: TObject);
    procedure DBEdit6Exit(Sender: TObject);
    procedure DBEdit7Exit(Sender: TObject);
    procedure DBEdit7Enter(Sender: TObject);
    procedure DBEdit8Enter(Sender: TObject);
    procedure DBEdit8Exit(Sender: TObject);
    procedure btnIncluirClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fRepresentante: TfRepresentante;

implementation

uses UDM;

{$R *.dfm}

procedure TfRepresentante.FormShow(Sender: TObject);
begin
  inherited;
   if dm.cds_repre.Active then
     dm.cds_repre.Close;
     dm.cds_repre.Params[0].AsInteger := dm.cds_inquilinoCOD_INQUILINO.AsInteger;
     dm.cds_repre.Open;
   btnIncluir.SetFocus;  
end;

procedure TfRepresentante.DBEdit1Enter(Sender: TObject);
begin
  inherited;
  DBEdit1.Color := clYellow;
end;

procedure TfRepresentante.DBEdit1Exit(Sender: TObject);
begin
  inherited;
  DBEdit1.Color := clWindow;
end;

procedure TfRepresentante.DBEdit2Enter(Sender: TObject);
begin
  inherited;
   DBEdit2.Color := clYellow;
end;

procedure TfRepresentante.DBEdit2Exit(Sender: TObject);
begin
  inherited;
  DBEdit2.Color := clWindow;
end;

procedure TfRepresentante.DBEdit3Enter(Sender: TObject);
begin
  inherited;
  DBEdit3.Color := clYellow;
end;

procedure TfRepresentante.DBEdit3Exit(Sender: TObject);
begin
  inherited;
  DBEdit3.Color := clWindow;
end;

procedure TfRepresentante.DBComboBox2Exit(Sender: TObject);
begin
  inherited;
  DBComboBox2.Color := clWindow;
end;

procedure TfRepresentante.DBComboBox2Enter(Sender: TObject);
begin
  inherited;
  DBComboBox2.Color := clYellow;
end;

procedure TfRepresentante.DBComboBox4Exit(Sender: TObject);
begin
  inherited;
  DBComboBox4.Color := clWindow;
end;

procedure TfRepresentante.DBComboBox4Enter(Sender: TObject);
begin
  inherited;
  DBComboBox4.Color := clYellow;
end;

procedure TfRepresentante.DBEdit4Enter(Sender: TObject);
begin
  inherited;
  DBEdit4.Color := clYellow;
end;

procedure TfRepresentante.DBEdit4Exit(Sender: TObject);
begin
  inherited;
  DBEdit4.Color := clWindow;
end;

procedure TfRepresentante.DBEdit5Exit(Sender: TObject);
begin
  inherited;
  DBEdit5.Color := clWindow;
end;

procedure TfRepresentante.DBEdit5Enter(Sender: TObject);
begin
  inherited;
  DBEdit5.Color := clYellow;
end;

procedure TfRepresentante.DBEdit6Enter(Sender: TObject);
begin
  inherited;
  DBEdit6.Color := clYellow;
end;

procedure TfRepresentante.DBEdit6Exit(Sender: TObject);
begin
  inherited;
  DBEdit6.Color := clWindow;
end;

procedure TfRepresentante.DBEdit7Exit(Sender: TObject);
begin
  inherited;
  DBEdit7.Color := clWindow;
end;

procedure TfRepresentante.DBEdit7Enter(Sender: TObject);
begin
  inherited;
  DBEdit7.Color := clYellow;
end;

procedure TfRepresentante.DBEdit8Enter(Sender: TObject);
begin
  inherited;
  DBEdit8.Color := clYellow;
end;

procedure TfRepresentante.DBEdit8Exit(Sender: TObject);
begin
  inherited;
  DBEdit8.Color := clWindow;
  if DM.cds_repre.State in [dsInsert, dsEdit] then
   btngravar.SetFocus
  else
   btnSair.SetFocus;

end;

procedure TfRepresentante.btnIncluirClick(Sender: TObject);
begin
  inherited;
  DBEdit1.SetFocus;
end;

end.
